home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gradius3.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  18KB  |  564 lines

  1. /***************************************************************************
  2.  
  3. Gradius 3 (GX945) (c) 1989 Konami
  4.  
  5. driver by Nicola Salmoria
  6.  
  7. This board uses the well known 052109 051962 custom gfx chips, however unlike
  8. all other games they fetch gfx data from RAM. The gfx ROMs are memory mapped
  9. on cpu B and the needed parts are copied to RAM at run time.
  10. To handle this efficiently in MAME, some changes would be required to the
  11. tilemap system and to vidhrdw/konamiic.c. For the time being, I'm kludging
  12. my way in.
  13. There's also something wrong in the way tile banks are implemented in
  14. konamiic.c. They don't seem to be used by this game.
  15.  
  16. The visible area is dubious. It looks like it is supposed to be asymmetrical,
  17. I've set it that way however this will break cocktail flip (since it expects
  18. a symmetrical visible area).
  19.  
  20. ***************************************************************************/
  21.  
  22. #include "driver.h"
  23. #include "vidhrdw/generic.h"
  24. #include "vidhrdw/konamiic.h"
  25. #include "cpu/m68000/m68000.h"
  26. #include "cpu/z80/z80.h"
  27.  
  28.  
  29. extern unsigned char *gradius3_gfxram;
  30. extern int gradius3_priority;
  31. int gradius3_vh_start(void);
  32. void gradius3_vh_stop(void);
  33. READ_HANDLER( gradius3_gfxrom_r );
  34. READ_HANDLER( gradius3_gfxram_r );
  35. WRITE_HANDLER( gradius3_gfxram_w );
  36. void gradius3_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  37.  
  38.  
  39.  
  40. static READ_HANDLER( K052109_halfword_r )
  41. {
  42.     return K052109_r(offset >> 1);
  43. }
  44.  
  45. static WRITE_HANDLER( K052109_halfword_w )
  46. {
  47.     if ((data & 0x00ff0000) == 0)
  48.         K052109_w(offset >> 1,data & 0xff);
  49.  
  50.     /* is this a bug in the game or something else? */
  51.     if ((data & 0x00ff0000) == 0x00ff0000)
  52.         K052109_w(offset >> 1,(data >> 8) & 0xff);
  53. //        logerror("%06x half %04x = %04x\n",cpu_get_pc(),offset,data);
  54. }
  55.  
  56. static READ_HANDLER( K051937_halfword_r )
  57. {
  58.     return K051937_r(offset >> 1);
  59. }
  60.  
  61. static WRITE_HANDLER( K051937_halfword_w )
  62. {
  63.     if ((data & 0x00ff0000) == 0)
  64.         K051937_w(offset >> 1,data & 0xff);
  65. }
  66.  
  67. static READ_HANDLER( K051960_halfword_r )
  68. {
  69.     return K051960_r(offset >> 1);
  70. }
  71.  
  72. static WRITE_HANDLER( K051960_halfword_w )
  73. {
  74.     if ((data & 0x00ff0000) == 0)
  75.         K051960_w(offset >> 1,data & 0xff);
  76. }
  77.  
  78.  
  79.  
  80. static int irqAen,irqBmask;
  81.  
  82.  
  83. static void gradius3_init(void)
  84. {
  85.     /* start with cpu B halted */
  86.     cpu_set_reset_line(1,ASSERT_LINE);
  87.     irqAen = 0;
  88.     irqBmask = 0;
  89. }
  90.  
  91. static unsigned char *sharedram;
  92.  
  93. static READ_HANDLER( sharedram_r )
  94. {
  95.     return READ_WORD(&sharedram[offset]);
  96. }
  97.  
  98. static WRITE_HANDLER( sharedram_w )
  99. {
  100.     COMBINE_WORD_MEM(&sharedram[offset],data);
  101. }
  102.  
  103. static WRITE_HANDLER( cpuA_ctrl_w )
  104. {
  105.     if ((data & 0xff000000) == 0)
  106.     {
  107.         data >>= 8;
  108.  
  109.         /* bits 0-1 are coin counters */
  110.         coin_counter_w(0,data & 0x01);
  111.         coin_counter_w(1,data & 0x02);
  112.  
  113.         /* bit 2 selects layer priority */
  114.         gradius3_priority = data & 0x04;
  115.  
  116.         /* bit 3 enables cpu B */
  117.         cpu_set_reset_line(1,(data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
  118.  
  119.         /* bit 5 enables irq */
  120.         irqAen = data & 0x20;
  121.  
  122.         /* other bits unknown */
  123. //logerror("%06x: write %04x to c0000\n",cpu_get_pc(),data);
  124.     }
  125. }
  126.  
  127. static WRITE_HANDLER( cpuB_irqenable_w )
  128. {
  129.     if ((data & 0xff000000) == 0)
  130.         irqBmask = (data >> 8) & 0x07;
  131. }
  132.  
  133. static int cpuA_interrupt(void)
  134. {
  135.     if (irqAen) return 2;
  136.     return 0;
  137. }
  138.  
  139. static int cpuB_interrupt(void)
  140. {
  141.     if (cpu_getiloops() & 1)    /* ??? */
  142.     {
  143.         if (irqBmask & 2) return 2;
  144.     }
  145.     else
  146.     {
  147.         if (irqBmask & 1) return 1;
  148.     }
  149.     return 0;
  150. }
  151.  
  152. static WRITE_HANDLER( cpuB_irqtrigger_w )
  153. {
  154.     if (irqBmask & 4)
  155.     {
  156. logerror("%04x trigger cpu B irq 4 %02x\n",cpu_get_pc(),data);
  157.         cpu_cause_interrupt(1,4);
  158.     }
  159.     else
  160. logerror("%04x MISSED cpu B irq 4 %02x\n",cpu_get_pc(),data);
  161. }
  162.  
  163. static WRITE_HANDLER( sound_command_w )
  164. {
  165.     if ((data & 0xff000000) == 0)
  166.         soundlatch_w(0,(data >> 8) & 0xff);
  167. }
  168.  
  169. static WRITE_HANDLER( sound_irq_w )
  170. {
  171.     cpu_cause_interrupt(2,0xff);
  172. }
  173.  
  174. static WRITE_HANDLER( sound_bank_w )
  175. {
  176.     unsigned char *RAM = memory_region(REGION_SOUND1);
  177.     int bank_A, bank_B;
  178.  
  179.     /* banks # for the 007232 (chip 1) */
  180.     bank_A = 0x20000 * ((data >> 0) & 0x03);
  181.     bank_B = 0x20000 * ((data >> 2) & 0x03);
  182.     K007232_bankswitch(0,RAM + bank_A,RAM + bank_B);
  183. }
  184.  
  185.  
  186.  
  187. static struct MemoryReadAddress gradius3_readmem[] =
  188. {
  189.     { 0x000000, 0x03ffff, MRA_ROM },
  190.     { 0x040000, 0x043fff, MRA_BANK1 },    /* main RAM */
  191.     { 0x080000, 0x080fff, paletteram_word_r },
  192.     { 0x0c8000, 0x0c8001, input_port_0_r },
  193.     { 0x0c8002, 0x0c8003, input_port_1_r },
  194.     { 0x0c8004, 0x0c8005, input_port_2_r },
  195.     { 0x0c8006, 0x0c8007, input_port_5_r },
  196.     { 0x0d0000, 0x0d0001, input_port_3_r },
  197.     { 0x0d0002, 0x0d0003, input_port_4_r },
  198.     { 0x100000, 0x103fff, sharedram_r },
  199.     { 0x14c000, 0x153fff, K052109_halfword_r },
  200.     { 0x180000, 0x19ffff, gradius3_gfxram_r },
  201. #if 0
  202.     { 0x140000, 0x140007, K051937_word_r },
  203.     { 0x140400, 0x1407ff, K051960_word_r },
  204. #endif
  205.     { -1 }    /* end of table */
  206. };
  207.  
  208. static struct MemoryWriteAddress gradius3_writemem[] =
  209. {
  210.     { 0x000000, 0x03ffff, MWA_ROM },
  211.     { 0x040000, 0x043fff, MWA_BANK1 },    /* main RAM */
  212.     { 0x080000, 0x080fff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram },
  213.     { 0x0c0000, 0x0c0001, cpuA_ctrl_w },    /* halt cpu B, irq enable, priority, coin counters, other? */
  214.     { 0x0d8000, 0x0d8001, cpuB_irqtrigger_w },
  215.     { 0x0e0000, 0x0e0001, watchdog_reset_w },
  216.     { 0x0e8000, 0x0e8001, sound_command_w },
  217.     { 0x0f0000, 0x0f0001, sound_irq_w },
  218.     { 0x100000, 0x103fff, sharedram_w, &sharedram },
  219.     { 0x14c000, 0x153fff, K052109_halfword_w },
  220.     { 0x180000, 0x19ffff, gradius3_gfxram_w, &gradius3_gfxram },
  221.     { -1 }    /* end of table */
  222. };
  223.  
  224.  
  225. static struct MemoryReadAddress gradius3_readmem2[] =
  226. {
  227.     { 0x000000, 0x0fffff, MRA_ROM },
  228.     { 0x100000, 0x103fff, MRA_BANK2 },    /* main RAM */
  229.     { 0x200000, 0x203fff, sharedram_r },
  230.     { 0x24c000, 0x253fff, K052109_halfword_r },
  231.     { 0x280000, 0x29ffff, gradius3_gfxram_r },
  232.     { 0x2c0000, 0x2c000f, K051937_halfword_r },
  233.     { 0x2c0800, 0x2c0fff, K051960_halfword_r },
  234.     { 0x400000, 0x5fffff, gradius3_gfxrom_r },        /* gfx ROMs are mapped here, and copied to RAM */
  235.     { -1 }    /* end of table */
  236. };
  237.  
  238. static struct MemoryWriteAddress gradius3_writemem2[] =
  239. {
  240.     { 0x000000, 0x0fffff, MWA_ROM },
  241.     { 0x100000, 0x103fff, MWA_BANK2 },    /* main RAM */
  242.     { 0x140000, 0x140001, cpuB_irqenable_w },
  243.     { 0x200000, 0x203fff, sharedram_w },
  244.     { 0x24c000, 0x253fff, K052109_halfword_w },
  245.     { 0x280000, 0x29ffff, gradius3_gfxram_w },
  246.     { 0x2c0000, 0x2c000f, K051937_halfword_w },
  247.     { 0x2c0800, 0x2c0fff, K051960_halfword_w },
  248.     { -1 }    /* end of table */
  249. };
  250.  
  251.  
  252. static struct MemoryReadAddress gradius3_s_readmem[] =
  253. {
  254.     { 0x0000, 0xefff, MRA_ROM },
  255.     { 0xf010, 0xf010, soundlatch_r },
  256.     { 0xf020, 0xf02d, K007232_read_port_0_r },
  257.     { 0xf031, 0xf031, YM2151_status_port_0_r },
  258.     { 0xf800, 0xffff, MRA_RAM },
  259.     { -1 }    /* end of table */
  260. };
  261.  
  262. static struct MemoryWriteAddress gradius3_s_writemem[] =
  263. {
  264.     { 0x0000, 0xefff, MWA_ROM },
  265.     { 0xf000, 0xf000, sound_bank_w },                /* 007232 bankswitch */
  266.     { 0xf020, 0xf02d, K007232_write_port_0_w },
  267.     { 0xf030, 0xf030, YM2151_register_port_0_w },
  268.     { 0xf031, 0xf031, YM2151_data_port_0_w },
  269.     { 0xf800, 0xffff, MWA_RAM },
  270.     { -1 }    /* end of table */
  271. };
  272.  
  273.  
  274.  
  275. INPUT_PORTS_START( gradius3 )
  276.     PORT_START      /* COINS */
  277.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  278.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  279.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  280.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  281.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  282.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  283.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
  284.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  285.  
  286.     PORT_START      /* PLAYER 1 */
  287.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  288.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  289.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  290.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  291.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
  292.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  293.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
  294.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  295.  
  296.     PORT_START      /* PLAYER 2 */
  297.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_COCKTAIL | IPF_8WAY )
  298.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL | IPF_8WAY )
  299.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_COCKTAIL | IPF_8WAY )
  300.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_COCKTAIL | IPF_8WAY )
  301.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  302.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  303.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  304.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  305.  
  306.     PORT_START    /* DSW1 */
  307.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  308.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  309.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  310.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  311.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  312.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  313.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  314.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  315.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  316.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  317.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  318.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  319.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  320.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  321.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  322.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  323.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  324.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  325.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  326.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  327.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  328.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  329.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  330.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  331.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  332.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  333.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  334.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  335.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  336.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  337.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  338.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  339.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  340. //    PORT_DIPSETTING(    0x00, "Invalid" )
  341.  
  342.     PORT_START    /* DSW2 */
  343.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  344.     PORT_DIPSETTING(    0x03, "2" )
  345.     PORT_DIPSETTING(    0x02, "3" )
  346.     PORT_DIPSETTING(    0x01, "5" )
  347.     PORT_DIPSETTING(    0x00, "7" )
  348.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  349.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  350.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  351.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  352.     PORT_DIPSETTING(    0x18, "20000 and every 70000" )
  353.     PORT_DIPSETTING(    0x10, "100000 and every 100000" )
  354.     PORT_DIPSETTING(    0x08, "50000" )
  355.     PORT_DIPSETTING(    0x00, "100000" )
  356.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  357.     PORT_DIPSETTING(    0x60, "Easy" )
  358.     PORT_DIPSETTING(    0x40, "Normal" )
  359.     PORT_DIPSETTING(    0x20, "Hard" )
  360.     PORT_DIPSETTING(    0x00, "Hardest" )
  361.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  362.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  363.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  364.  
  365.     PORT_START    /* DSW3 */
  366.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  367.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  368.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  369.     PORT_DIPNAME( 0x02, 0x02, "Upright Controls" )
  370.     PORT_DIPSETTING(    0x02, "Single" )
  371.     PORT_DIPSETTING(    0x00, "Dual" )
  372.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  373.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  374.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  375.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  376.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  377. INPUT_PORTS_END
  378.  
  379.  
  380.  
  381. static struct YM2151interface ym2151_interface =
  382. {
  383.     1,            /* 1 chip */
  384.     3579545,    /* 3.579545 MHz */
  385.     { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) },
  386.     { 0 }
  387. };
  388.  
  389. static void volume_callback(int v)
  390. {
  391.     K007232_set_volume(0,0,(v >> 4) * 0x11,0);
  392.     K007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
  393. }
  394.  
  395. static struct K007232_interface k007232_interface =
  396. {
  397.     1,        /* number of chips */
  398.     { REGION_SOUND1 },    /* memory regions */
  399.     { K007232_VOL(20,MIXER_PAN_CENTER,20,MIXER_PAN_CENTER) },    /* volume */
  400.     { volume_callback }    /* external port callback */
  401. };
  402.  
  403.  
  404.  
  405. static struct MachineDriver machine_driver_gradius3 =
  406. {
  407.     /* basic machine hardware */
  408.     {
  409.         {
  410.             CPU_M68000,
  411.             10000000,    /* 10 MHz */
  412.             gradius3_readmem,gradius3_writemem,0,0,
  413.             cpuA_interrupt,1
  414.         },
  415.         {
  416.             CPU_M68000,
  417.             10000000,    /* 10 MHz */
  418.             gradius3_readmem2,gradius3_writemem2,0,0,
  419.             cpuB_interrupt,2    /* has three interrupt vectors, 1 2 and 4 */
  420.                                 /* 4 is triggered by cpu A, the others are unknown but */
  421.                                 /* required for the game to run. */
  422.         },
  423.         {
  424.             CPU_Z80 | CPU_AUDIO_CPU,
  425.             3579545,    /* 3.579545 MHz */
  426.             gradius3_s_readmem,gradius3_s_writemem,0,0,
  427.             ignore_interrupt,0    /* IRQs are triggered by the main CPU */
  428.         }
  429.     },
  430.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  431.     100, /* CPU slices */
  432.     gradius3_init,
  433.  
  434.     /* video hardware */
  435.     64*8, 32*8, { 12*8, (64-14)*8-1, 2*8, 30*8-1 },    /* asymmetrical! */
  436.     0,    /* gfx decoded by konamiic.c */
  437.     2048, 2048,
  438.     0,
  439.  
  440.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  441.     0,
  442.     gradius3_vh_start,
  443.     gradius3_vh_stop,
  444.     gradius3_vh_screenrefresh,
  445.  
  446.     /* sound hardware */
  447.     SOUND_SUPPORTS_STEREO,0,0,0,
  448.     {
  449.         {
  450.             SOUND_YM2151,
  451.             &ym2151_interface
  452.         },
  453.         {
  454.             SOUND_K007232,
  455.             &k007232_interface,
  456.         }
  457.     }
  458. };
  459.  
  460.  
  461.  
  462. /***************************************************************************
  463.  
  464.   Game driver(s)
  465.  
  466. ***************************************************************************/
  467.  
  468. ROM_START( gradius3 )
  469.     ROM_REGION( 0x40000, REGION_CPU1 )
  470.     ROM_LOAD_EVEN( "945s13.f15",   0x00000, 0x20000, 0x70c240a2 )
  471.     ROM_LOAD_ODD ( "945s12.e15",   0x00000, 0x20000, 0xbbc300d4 )
  472.  
  473.     ROM_REGION( 0x100000, REGION_CPU2 )
  474.     ROM_LOAD_EVEN( "g3_r17.rom",   0x000000, 0x20000, 0xb4a6df25 )
  475.     ROM_LOAD_ODD ( "g3_n17.rom",   0x000000, 0x20000, 0x74e981d2 )
  476.     ROM_LOAD_EVEN( "g3_r11.rom",   0x040000, 0x20000, 0x83772304 )
  477.     ROM_LOAD_ODD ( "g3_n11.rom",   0x040000, 0x20000, 0xe1fd75b6 )
  478.     ROM_LOAD_EVEN( "g3_r15.rom",   0x080000, 0x20000, 0xc1e399b6 )
  479.     ROM_LOAD_ODD ( "g3_n15.rom",   0x080000, 0x20000, 0x96222d04 )
  480.     ROM_LOAD_EVEN( "g3_r13.rom",   0x0c0000, 0x20000, 0x4c16d4bd )
  481.     ROM_LOAD_ODD ( "g3_n13.rom",   0x0c0000, 0x20000, 0x5e209d01 )
  482.  
  483.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the audio CPU */
  484.     ROM_LOAD( "g3_d9.rom",    0x00000, 0x10000, 0xc8c45365 )
  485.  
  486.     ROM_REGION( 0x20000, REGION_GFX1 )    /* fake */
  487.     /* gfx data is dynamically generated in RAM */
  488.  
  489.     ROM_REGION( 0x200000, REGION_GFX2 )    /* graphics (addressable by the main CPU) */
  490.     ROM_LOAD( "945a02.l3",             0x000000, 0x80000, 0x4dfffd74 )
  491.     ROM_LOAD_GFX_EVEN( "g3_k6.rom",    0x080000, 0x20000, 0x884e21ee )
  492.     ROM_LOAD_GFX_ODD ( "g3_m6.rom",    0x080000, 0x20000, 0x45bcd921 )
  493.     ROM_LOAD_GFX_EVEN( "g3_k8.rom",    0x0c0000, 0x20000, 0x843bc67d )
  494.     ROM_LOAD_GFX_ODD ( "g3_m8.rom",    0x0c0000, 0x20000, 0x0a98d08e )
  495.     ROM_LOAD( "945a01.h3",             0x100000, 0x80000, 0x339d6dd2 )
  496.     ROM_LOAD_GFX_EVEN( "g3_e6.rom",    0x180000, 0x20000, 0xa67ef087 )
  497.     ROM_LOAD_GFX_ODD ( "g3_h6.rom",    0x180000, 0x20000, 0xa56be17a )
  498.     ROM_LOAD_GFX_EVEN( "g3_e8.rom",    0x1c0000, 0x20000, 0x933e68b9 )
  499.     ROM_LOAD_GFX_ODD ( "g3_h8.rom",    0x1c0000, 0x20000, 0xf375e87b )
  500.  
  501.     ROM_REGION( 0x0100, REGION_PROMS )
  502.     ROM_LOAD( "945l14.j28",  0x0000, 0x0100, 0xc778c189 )    /* priority encoder (not used) */
  503.  
  504.     ROM_REGION( 0x80000, REGION_SOUND1 )    /* 007232 samples */
  505.     ROM_LOAD( "945a10.bin",   0x00000, 0x40000, 0x1d083e10 )
  506.     ROM_LOAD( "g3_c18.rom",   0x40000, 0x20000, 0x6043f4eb )
  507.     ROM_LOAD( "g3_c20.rom",   0x60000, 0x20000, 0x89ea3baf )
  508. ROM_END
  509.  
  510. ROM_START( grdius3a )
  511.     ROM_REGION( 0x40000, REGION_CPU1 )
  512.     ROM_LOAD_EVEN( "g3_f15.rom",   0x00000, 0x20000, 0x9974fe6b )
  513.     ROM_LOAD_ODD ( "g3_e15.rom",   0x00000, 0x20000, 0xe9771b91 )
  514.  
  515.     ROM_REGION( 0x100000, REGION_CPU2 )
  516.     ROM_LOAD_EVEN( "g3_r17.rom",   0x000000, 0x20000, 0xb4a6df25 )
  517.     ROM_LOAD_ODD ( "g3_n17.rom",   0x000000, 0x20000, 0x74e981d2 )
  518.     ROM_LOAD_EVEN( "g3_r11.rom",   0x040000, 0x20000, 0x83772304 )
  519.     ROM_LOAD_ODD ( "g3_n11.rom",   0x040000, 0x20000, 0xe1fd75b6 )
  520.     ROM_LOAD_EVEN( "g3_r15.rom",   0x080000, 0x20000, 0xc1e399b6 )
  521.     ROM_LOAD_ODD ( "g3_n15.rom",   0x080000, 0x20000, 0x96222d04 )
  522.     ROM_LOAD_EVEN( "g3_r13.rom",   0x0c0000, 0x20000, 0x4c16d4bd )
  523.     ROM_LOAD_ODD ( "g3_n13.rom",   0x0c0000, 0x20000, 0x5e209d01 )
  524.  
  525.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for the audio CPU */
  526.     ROM_LOAD( "g3_d9.rom",    0x00000, 0x10000, 0xc8c45365 )
  527.  
  528.     ROM_REGION( 0x20000, REGION_GFX1 )    /* fake */
  529.     /* gfx data is dynamically generated in RAM */
  530.  
  531.     ROM_REGION( 0x200000, REGION_GFX2 )    /* graphics (addressable by the main CPU) */
  532.     ROM_LOAD( "945a02.l3",             0x000000, 0x80000, 0x4dfffd74 )
  533.     ROM_LOAD_GFX_EVEN( "g3_k6.rom",    0x080000, 0x20000, 0x884e21ee )
  534.     ROM_LOAD_GFX_ODD ( "g3_m6.rom",    0x080000, 0x20000, 0x45bcd921 )
  535.     ROM_LOAD_GFX_EVEN( "g3_k8.rom",    0x0c0000, 0x20000, 0x843bc67d )
  536.     ROM_LOAD_GFX_ODD ( "g3_m8.rom",    0x0c0000, 0x20000, 0x0a98d08e )
  537.     ROM_LOAD( "945a01.h3",             0x100000, 0x80000, 0x339d6dd2 )
  538.     ROM_LOAD_GFX_EVEN( "g3_e6.rom",    0x180000, 0x20000, 0xa67ef087 )
  539.     ROM_LOAD_GFX_ODD ( "g3_h6.rom",    0x180000, 0x20000, 0xa56be17a )
  540.     ROM_LOAD_GFX_EVEN( "g3_e8.rom",    0x1c0000, 0x20000, 0x933e68b9 )
  541.     ROM_LOAD_GFX_ODD ( "g3_h8.rom",    0x1c0000, 0x20000, 0xf375e87b )
  542.  
  543.     ROM_REGION( 0x0100, REGION_PROMS )
  544.     ROM_LOAD( "945l14.j28",  0x0000, 0x0100, 0xc778c189 )    /* priority encoder (not used) */
  545.  
  546.     ROM_REGION( 0x80000, REGION_SOUND1 )    /* 007232 samples */
  547.     ROM_LOAD( "945a10.bin",   0x00000, 0x40000, 0x1d083e10 )
  548.     ROM_LOAD( "g3_c18.rom",   0x40000, 0x20000, 0x6043f4eb )
  549.     ROM_LOAD( "g3_c20.rom",   0x60000, 0x20000, 0x89ea3baf )
  550. ROM_END
  551.  
  552.  
  553.  
  554. static void init_gradius3(void)
  555. {
  556.     konami_rom_deinterleave_2(REGION_GFX2);
  557. }
  558.  
  559.  
  560.  
  561. GAME( 1989, gradius3, 0,        gradius3, gradius3, gradius3, ROT0, "Konami", "Gradius III (Japan)" )
  562. GAME( 1989, grdius3a, gradius3, gradius3, gradius3, gradius3, ROT0, "Konami", "Gradius III (Asia)" )
  563.  
  564.